package dao;

import com.study.io.Resources;
import com.study.sqlSession.SqlSession;
import com.study.sqlSession.SqlSessionFactory;
import com.study.sqlSession.SqlSessionFactoryBuilder;
import pojo.Coin;

import java.io.InputStream;

public class ICoinDaoImple implements ICoinDao {
    @Override
    public Coin findByCondition(Coin coin) throws Exception {
        InputStream resourceAsStream = Resources.getResourceAsStream("sqlMapConfig.xml");
        SqlSessionFactory sqlSessionFactory = new SqlSessionFactoryBuilder().build(resourceAsStream);
        SqlSession sqlSession = sqlSessionFactory.openSession();

        // 调用
        Coin coinRes = sqlSession.getMapper(ICoinDao.class);
        return coinRes;
    }

    @Override
    public int updateByCondition(Coin coin) throws Exception {
        return 0;
    }

    @Override
    public int insertSave(Coin coin) throws Exception {
        return 0;
    }

    @Override
    public int deleteByCondition(Coin coin) throws Exception {
        return 0;
    }
}
